-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: use extra_body for DeepSeek V3.1 Terminus reasoning control #8814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Review SummaryI've reviewed the changes in this PR. Found 2 code quality improvements:
The implementation correctly adds |
| ? { | ||
| chat_template_kwargs: { | ||
| // Default OFF unless explicitly requested via reasoning settings | ||
| thinking: Boolean(reasoning) && !(reasoning as any)?.exclude, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type assertion (reasoning as any)?.exclude is unnecessary. Since reasoning is of type OpenRouterReasoningParams | undefined and OpenRouterReasoningParams already has exclude?: boolean as a property, you can safely use reasoning?.exclude instead. Removing the as any cast improves type safety and maintainability.
| thinking: Boolean(reasoning) && !(reasoning as any)?.exclude, | |
| thinking: Boolean(reasoning) && !reasoning?.exclude, |
| ? { | ||
| chat_template_kwargs: { | ||
| // Default OFF unless explicitly requested via reasoning settings | ||
| thinking: Boolean(reasoning) && !(reasoning as any)?.exclude, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type assertion (reasoning as any)?.exclude is unnecessary here as well. Since reasoning is of type OpenRouterReasoningParams | undefined and OpenRouterReasoningParams already has exclude?: boolean as a property, you can safely use reasoning?.exclude instead.
| thinking: Boolean(reasoning) && !(reasoning as any)?.exclude, | |
| thinking: Boolean(reasoning) && !reasoning?.exclude, |
Per request to create a new PR that only adds extra_body for DeepSeek V3.1 Terminus (no integration test changes). Implementation: in OpenRouterHandler, add extra_body with chat_template_kwargs.thinking for DeepSeek-V3.1-Terminus and avoid passing the OpenRouter reasoning param for this model. Relevant unit tests pass locally.
Important
Add
extra_bodyfor DeepSeek V3.1 Terminus inOpenRouterHandlerto control reasoning, replacingreasoningparam for this model.extra_bodyparameter inOpenRouterHandlerfor DeepSeek V3.1 Terminus to control reasoning.extra_bodyuseschat_template_kwargs.thinkingbased onreasoningsettings.reasoningparam for DeepSeek V3.1 Terminus; useextra_bodyinstead.createMessageandcompletePromptmethods inopenrouter.tsto includeextra_bodyfor DeepSeek V3.1 Terminus.modelIdfor "DeepSeek-V3.1-Terminus" to conditionally applyextra_body.This description was created by
for 8bcbaf5. You can customize this summary. It will automatically update as commits are pushed.